//
//  Kylin_ScoreTableViewController.m
//  01-LotteryBaseFrame
//
//  Created by Kylin on 16/1/9.
//  Copyright © 2016年 kylin. All rights reserved.
//

#import "Kylin_ScoreTableViewController.h"

@implementation Kylin_ScoreTableViewController

- (void)viewDidLoad{
    
    [self setUpGroup0];
    
    [self setUpGroup1];
    
    [self setUpGroup2];


}

- (void)setUpGroup0{
    
    Kylin_SettingItem *item = [Kylin_SettingSwitchItem itemWithTitle:@"关注比赛"];
    Kylin_SettingGroup *group = [Kylin_SettingGroup groupWithItems:@[item]];
    
    group.headerText = @"game";
    
    [self.groups addObject:group];
}

- (void)setUpGroup1{
    
    Kylin_SettingItem *item1 = [Kylin_SettingItem itemWithTitle:@"起止时间"];
    Kylin_SettingGroup *group = [Kylin_SettingGroup groupWithItems:@[item1]];
    item1.subTitle = @"00:00";
    
    [self.groups addObject:group];
}

- (void)setUpGroup2{
    Kylin_SettingItem *item2 = [Kylin_SettingItem itemWithTitle:@"结束时间"];
    Kylin_SettingGroup *group = [Kylin_SettingGroup groupWithItems:@[item2]];
    item2.subTitle = @"23:50";

    // 自动适配键盘
    item2.operationBlock = ^(NSIndexPath *indexPath){
        
        UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
        
        UITextField *textField = [[UITextField alloc]init];
        
        [textField becomeFirstResponder];
        
       
        [cell addSubview:textField];
    };
    
    [self.groups addObject:group];
}

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
    // 当滚动时,停止编辑,退出键盘
//    [self.view endEditing:YES];
}

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
    [self.view endEditing:YES];
}
@end
